home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-09-11 | 2.8 KB | 101 lines | [TEXT/CWIE] |
- // VectorAccessor.h
- // Copyright: © 1994 - 1996-1997 by Apple Computer, Inc., all rights reserved.
- // Implements ExactSearch and RankedSearch over VectorIndices
-
- #pragma once
- #ifndef VectorAccessor_h
- #define VectorAccessor_h
-
- #pragma import on
-
- #include "RankedAccessor.h"
- #include "TWVector.h"
-
- #pragma IA_BEGIN_EXPORTS
-
- class VectorIndex;
- class IAQuery;
-
- const uint32 VectorAccessorType = 'Vec0';
-
- class VectorAccessor : public virtual RankedAccessor {
- friend class VectorScorer;
- public:
- VectorAccessor(VectorIndex** indices, uint32 indexCount, uint32 t = VectorAccessorType);
- VectorAccessor(VectorIndex** index_ptr_ptr, TermIndex* context);
- ~VectorAccessor();
-
-
- uint32 RankedSearch(byte* textQuery, uint32 textQueryLen,
- RankedQueryDoc* docQuery, uint32 docQueryLen,
- RankedHit** results, uint32 resultLen,
- uint32 matchingTermsLen,
- RankedProgressFn* progressFn,
- clock_t progressFreq,
- void* appData);
-
- uint32 RankedSearch(IADocText* textQuery,
- RankedQueryDoc* docQuery, uint32 docQueryLen,
- RankedHit** results, uint32 resultLen,
- uint32 matchingTermsLen,
- RankedProgressFn* progressFn,
- clock_t progressFreq,
- void* appData);
-
- uint32 GetDocTopic(RankedQueryDoc* doc,
- IATerm** results, uint32 resultLen,
- RankedProgressFn* progressFn,
- clock_t progressFreq,
- void* appData);
-
- uint32 GetTermsRelated(byte* term, uint32 termLen,
- IATerm** results, uint32 resultLen,
- RankedProgressFn* progressFn,
- clock_t progressFreq,
- void* appData);
-
- // returns the vector for a doc from the Nth index of this accessor
- TWVector* GetTWVector(IADoc* doc, uint32 index);
- protected:
- void Initializing();
-
- IABlockSize InitsSize();
- void StoringInits(IAOutputBlock* output);
- void RestoringInits(IAInputBlock* input);
-
- virtual void CacheTermStats(TermInfo** infos);
-
- float TermScaleFactor(uint32 index, TermID termID) {
- return TermScaleFactor(termScaleFactors[index], termID);
- }
- float TermScaleFactor(byte* scaleFactors, TermID termID) {
- return scaleFactorDecoder[scaleFactors[termID]];
- }
- private:
- byte** termScaleFactors;
- float* scaleFactorDecoder;
- byte* scaleFactorEncoder;
- float scaleFactorEncodingFactor;
-
- void MakeScaleFactorCodec();
- inline byte EncodeScaleFactor(TermFreq docCount);
- inline byte EncodeScaleFactorInternal(TermFreq docCount);
- void MergeTermInfos();
-
- IAIndex** UpcastIndices(VectorIndex** is, uint32 n);
- VectorAccessor(VectorAccessor&);
-
- uint32 GetDocTopicInternal(RankedQueryDoc* doc,
- TWVector** results,
- RankedProgressFn* progressFn,
- clock_t progressFreq,
- void* appData);
-
- };
-
- #pragma IA_END_EXPORTS
-
- #pragma import reset
-
- #endif
-